Bluetooth: hci_ldisc: check HCI_UART_PROTO_READY flag in HCIUARTGETPROTO
authorLee, Chun-Yi <joeyli.kernel@gmail.com>
Mon, 10 Jul 2023 15:17:23 +0000 (23:17 +0800)
committerSalvatore Bonaccorso <carnil@debian.org>
Sun, 22 Oct 2023 19:28:21 +0000 (21:28 +0200)
commitbe8d992424218acf7d4c46b6ed9d6632847b83b9
treedf416e010325e8a09daee61107019d2a1c57bd74
parentc2dc6c7b323f620324cfbc1a03e6d7d1c2996c5a
Bluetooth: hci_ldisc: check HCI_UART_PROTO_READY flag in HCIUARTGETPROTO

Origin: https://git.kernel.org/linus/9c33663af9ad115f90c076a1828129a3fbadea98
Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2023-31083

This patch adds code to check HCI_UART_PROTO_READY flag before
accessing hci_uart->proto. It fixes the race condition in
hci_uart_tty_ioctl() between HCIUARTSETPROTO and HCIUARTGETPROTO.
This issue bug found by Yu Hao and Weiteng Chen:

BUG: general protection fault in hci_uart_tty_ioctl [1]

The information of C reproducer can also reference the link [2]

Reported-by: Yu Hao <yhao016@ucr.edu>
Closes: https://lore.kernel.org/all/CA+UBctC3p49aTgzbVgkSZ2+TQcqq4fPDO7yZitFT5uBPDeCO2g@mail.gmail.com/ [1]
Reported-by: Weiteng Chen <wchen130@ucr.edu>
Closes: https://lore.kernel.org/lkml/CA+UBctDPEvHdkHMwD340=n02rh+jNRJNNQ5LBZNA+Wm4Keh2ow@mail.gmail.com/T/ [2]
Signed-off-by: "Lee, Chun-Yi" <jlee@suse.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Gbp-Pq: Topic bugfix/all
Gbp-Pq: Name Bluetooth-hci_ldisc-check-HCI_UART_PROTO_READY-flag-.patch
drivers/bluetooth/hci_ldisc.c